﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.Linq;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Documents;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows8Accelerator.Core.Xaml.Helpers;

namespace Windows8Accelerator.Core.Xaml.Controls
{
    [TemplatePart(Name="ZoomInList", Type=typeof(SuperListView))]
    [TemplatePart(Name="ZoomOutList", Type=typeof(SuperListView))]
    public sealed class SuperSemanticZoomListView : Control
    {
        private SuperListView ZoomInList;
        private SuperListView ZoomOutList;

        public SuperSemanticZoomListView()
        {
            this.DefaultStyleKey = typeof(SuperSemanticZoomListView);
            SelectedItems = new ObservableCollection<object>();
            SelectedItems.CollectionChanged += SelectedItems_CollectionChanged;
            SelectedGroups = new ObservableCollection<object>();
            SelectedGroups.CollectionChanged += SelectedGroups_CollectionChanged;
        }

        public DataTemplateSelector ItemTemplateSelector
        {
            get { return (DataTemplateSelector)GetValue(ItemTemplateSelectorProperty); }
            set { SetValue(ItemTemplateSelectorProperty, value); }
        }
        public static readonly DependencyProperty ItemTemplateSelectorProperty =
            DependencyProperty.Register("ItemTemplateSelector", typeof(DataTemplateSelector), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

            
        void SelectedGroups_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (ZoomOutList != null && !_SelfUpdating)
            {
                _SelfUpdating = true;
                if (GroupSelectionMode == ListViewSelectionMode.Extended || GroupSelectionMode == ListViewSelectionMode.Multiple)
                {
                    foreach (var item in e.NewItems)
                        if (!ZoomOutList.SelectedItems.Contains(item))
                            ZoomOutList.SelectedItems.Add(item);
                    foreach (var item in e.OldItems)
                        ZoomOutList.SelectedItems.Remove(item);
                }
                _SelfUpdating = false;
            }
        }

        void SelectedItems_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (ZoomInList != null && !_SelfUpdating)
            {
                _SelfUpdating = true;
                if (ItemSelectionMode == ListViewSelectionMode.Extended || ItemSelectionMode == ListViewSelectionMode.Multiple)
                {
                    foreach (var item in e.NewItems)
                        if (!ZoomInList.SelectedItems.Contains(item))
                            ZoomInList.SelectedItems.Add(item);
                    foreach (var item in e.OldItems)
                        ZoomInList.SelectedItems.Remove(item);
                }
                _SelfUpdating = false;
            }
        }

        public SuperMargin FullScreenLandscapePanelMargin
        {
            get { return (SuperMargin)GetValue(FullScreenLandscapePanelMarginProperty); }
            set { SetValue(FullScreenLandscapePanelMarginProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapePanelMarginProperty =
            DependencyProperty.Register("FullScreenLandscapePanelMargin", typeof(SuperMargin), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));
        public string FullScreenLandscapePanelMarginString
        {
            get { return FullScreenLandscapePanelMargin.ToString(); }
            set { SetValue(FullScreenLandscapePanelMarginProperty, new SuperMargin(value)); }
        }

        public SuperMargin FullScreenPortraitPanelMargin
        {
            get { return (SuperMargin)GetValue(FullScreenPortraitPanelMarginProperty); }
            set { SetValue(FullScreenPortraitPanelMarginProperty, value); }
        }
        public static readonly DependencyProperty FullScreenPortraitPanelMarginProperty =
            DependencyProperty.Register("FullScreenPortraitPanelMargin", typeof(SuperMargin), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));
        public string FullScreenPortraitPanelMarginString
        {
            get { return FullScreenPortraitPanelMargin.ToString(); }
            set { SetValue(FullScreenPortraitPanelMarginProperty, new SuperMargin(value)); }
        }

        public SuperMargin SnappedPanelMargin
        {
            get { return (SuperMargin)GetValue(SnappedPanelMarginProperty); }
            set { SetValue(SnappedPanelMarginProperty, value); }
        }
        public static readonly DependencyProperty SnappedPanelMarginProperty =
            DependencyProperty.Register("SnappedPanelMargin", typeof(SuperMargin), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));
        public string SnappedPanelMarginString
        {
            get { return SnappedPanelMargin.ToString(); }
            set { SetValue(SnappedPanelMarginProperty, new SuperMargin(value)); }
        }

        public SuperMargin FilledPanelMargin
        {
            get { return (SuperMargin)GetValue(FilledPanelMarginProperty); }
            set { SetValue(FilledPanelMarginProperty, value); }
        }
        public static readonly DependencyProperty FilledPanelMarginProperty =
            DependencyProperty.Register("FilledPanelMargin", typeof(SuperMargin), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));
        public string FilledPanelMarginString
        {
            get { return FilledPanelMargin.ToString(); }
            set { SetValue(FilledPanelMarginProperty, new SuperMargin(value)); }
        }

        public SuperMargin FullScreenLandscapeZoomedOutPanelMargin
        {
            get { return (SuperMargin)GetValue(FullScreenLandscapeZoomedOutPanelMarginProperty); }
            set { SetValue(FullScreenLandscapeZoomedOutPanelMarginProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeZoomedOutPanelMarginProperty =
            DependencyProperty.Register("FullScreenLandscapeZoomedOutPanelMargin", typeof(SuperMargin), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));
        public string FullScreenLandscapeZoomedOutPanelMarginString
        {
            get { return FullScreenLandscapeZoomedOutPanelMargin.ToString(); }
            set { SetValue(FullScreenLandscapeZoomedOutPanelMarginProperty, new SuperMargin(value)); }
        }

        public SuperMargin FullScreenPortraitZoomedOutPanelMargin
        {
            get { return (SuperMargin)GetValue(FullScreenPortraitZoomedOutPanelMarginProperty); }
            set { SetValue(FullScreenPortraitZoomedOutPanelMarginProperty, value); }
        }
        public static readonly DependencyProperty FullScreenPortraitZoomedOutPanelMarginProperty =
            DependencyProperty.Register("FullScreenPortraitZoomedOutPanelMargin", typeof(SuperMargin), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));
        public string FullScreenPortraitZoomedOutPanelMarginString
        {
            get { return FullScreenPortraitZoomedOutPanelMargin.ToString(); }
            set { SetValue(FullScreenPortraitZoomedOutPanelMarginProperty, new SuperMargin(value)); }
        }

        public SuperMargin SnappedZoomedOutPanelMargin
        {
            get { return (SuperMargin)GetValue(SnappedZoomedOutPanelMarginProperty); }
            set { SetValue(SnappedZoomedOutPanelMarginProperty, value); }
        }
        public static readonly DependencyProperty SnappedZoomedOutPanelMarginProperty =
            DependencyProperty.Register("SnappedZoomedOutPanelMargin", typeof(SuperMargin), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));
        public string SnappedZoomedOutPanelMarginString
        {
            get { return SnappedZoomedOutPanelMargin.ToString(); }
            set { SetValue(SnappedZoomedOutPanelMarginProperty, new SuperMargin(value)); }
        }

        public SuperMargin FilledZoomedOutPanelMargin
        {
            get { return (SuperMargin)GetValue(FilledZoomedOutPanelMarginProperty); }
            set { SetValue(FilledZoomedOutPanelMarginProperty, value); }
        }
        public static readonly DependencyProperty FilledZoomedOutPanelMarginProperty =
            DependencyProperty.Register("FilledZoomedOutPanelMargin", typeof(SuperMargin), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));
        public string FilledZoomedOutPanelMarginString
        {
            get { return FilledZoomedOutPanelMargin.ToString(); }
            set { SetValue(FilledZoomedOutPanelMarginProperty, new SuperMargin(value)); }
        }

        public object SelectedItem
        {
            get { return (object)GetValue(SelectedItemProperty); }
            set
            {
                SetValue(SelectedItemProperty, value);
                if (ZoomInList != null && !_SelfUpdating)
                {
                    _SelfUpdating = true;
                    ZoomInList.SelectedItem = value;
                    if (ItemSelectionMode == ListViewSelectionMode.Extended || ItemSelectionMode == ListViewSelectionMode.Multiple)
                    {
                        if (value != null && !SelectedItems.Contains(value))
                            SelectedItems.Add(value);
                    }
                    _SelfUpdating = false;
                }
            }
        }
        public static readonly DependencyProperty SelectedItemProperty =
            DependencyProperty.Register("SelectedItem", typeof(object), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public object SelectedGroup
        {
            get { return (object)GetValue(SelectedGroupProperty); }
            set
            {
                SetValue(SelectedGroupProperty, value);
                if (ZoomOutList != null && !_SelfUpdating)
                {
                    _SelfUpdating = true;
                    ZoomOutList.SelectedItem = value;
                    if (GroupSelectionMode == ListViewSelectionMode.Extended || GroupSelectionMode == ListViewSelectionMode.Multiple)
                    {
                        if (value != null && !SelectedGroups.Contains(value))
                            SelectedGroups.Add(value);
                    }
                    _SelfUpdating = false;
                }
            }
        }
        public static readonly DependencyProperty SelectedGroupProperty =
            DependencyProperty.Register("SelectedGroup", typeof(object), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public ObservableCollection<object> SelectedItems { get; private set; }
        public ObservableCollection<object> SelectedGroups { get; private set; }

        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
            ZoomInList = GetTemplateChild("ZoomInList") as SuperListView;
            ZoomOutList = GetTemplateChild("ZoomOutList") as SuperListView;
            if (ZoomInList != null)
            {
                ZoomInList.ItemColumnAndRowSpanSelector = _ItemColumnAndRowSpanSelector;
                ZoomOutList.ItemColumnAndRowSpanSelector = _GroupColumnAndRowSpanSelector;
                
                _SelfUpdating = true;

                ZoomInList.SelectedItem = SelectedItem;
                if (ItemSelectionMode == ListViewSelectionMode.Extended || ItemSelectionMode == ListViewSelectionMode.Multiple)
                {
                    if (SelectedItem != null && !ZoomInList.SelectedItems.Contains(SelectedItem))
                        ZoomInList.SelectedItems.Add(SelectedItem);
                    foreach (var item in SelectedItems.Where((o) => !ZoomInList.SelectedItems.Contains(o)))
                        ZoomInList.SelectedItems.Add(item);
                    foreach (var item in ZoomInList.SelectedItems.Where((o) => !SelectedItems.Contains(o) && o != SelectedItem))
                        ZoomInList.SelectedItems.Remove(item);
                }
                ZoomInList.SelectionChanged += ZoomInList_SelectionChanged;
                ZoomInList.ItemClick += ZoomInList_ItemClick;
                ZoomInList.GroupHeaderClick += ZoomInList_GroupHeaderClick;

                ZoomOutList.SelectedItem = SelectedGroup;
                if (GroupSelectionMode == ListViewSelectionMode.Extended || GroupSelectionMode == ListViewSelectionMode.Multiple)
                {
                    if (SelectedGroup != null && !ZoomOutList.SelectedItems.Contains(SelectedGroup))
                        ZoomOutList.SelectedItems.Add(SelectedGroup);
                    foreach (var item in SelectedGroups.Where((o) => !ZoomOutList.SelectedItems.Contains(o)))
                        ZoomOutList.SelectedItems.Add(item);
                    foreach (var item in ZoomOutList.SelectedItems.Where((o) => !SelectedGroups.Contains(o) && o != SelectedGroup))
                        ZoomOutList.SelectedItems.Remove(item);
                }
                ZoomOutList.SelectionChanged += ZoomOutList_SelectionChanged;
                ZoomOutList.ItemClick += ZoomOutList_ItemClick;

                _SelfUpdating = false;
            }
        }

        void ZoomInList_GroupHeaderClick(object sender, SuperItemClickEventArgs e)
        {
            if (PageDestinationTypeOnGroupHeaderClick != null)
            {
                var parentPage = this.GetParentOf<Page>();
                if (parentPage != null)
                    parentPage.Frame.Navigate(PageDestinationTypeOnGroupHeaderClick, e.Item);
            }

            if (GroupHeaderClick != null)
                GroupHeaderClick(sender, e);
        }

        public bool ZoomInOnGroupClick
        {
            get { return (bool)GetValue(ZoomInOnGroupClickProperty); }
            set { SetValue(ZoomInOnGroupClickProperty, value); }
        }
        public static readonly DependencyProperty ZoomInOnGroupClickProperty =
            DependencyProperty.Register("ZoomInOnGroupClick", typeof(bool), typeof(SuperSemanticZoomListView), new PropertyMetadata(true));

        public Type PageDestinationTypeOnItemClick
        {
            get { return (Type)GetValue(PageDestinationTypeOnItemClickProperty); }
            set { SetValue(PageDestinationTypeOnItemClickProperty, value); }
        }
        public static readonly DependencyProperty PageDestinationTypeOnItemClickProperty =
            DependencyProperty.Register("PageDestinationTypeOnItemClick", typeof(Type), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Type PageDestinationTypeOnGroupClick
        {
            get { return (Type)GetValue(PageDestinationTypeOnGroupClickProperty); }
            set { SetValue(PageDestinationTypeOnGroupClickProperty, value); }
        }
        public static readonly DependencyProperty PageDestinationTypeOnGroupClickProperty =
            DependencyProperty.Register("PageDestinationTypeOnGroupClick", typeof(Type), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Type PageDestinationTypeOnGroupHeaderClick
        {
            get { return (Type)GetValue(PageDestinationTypeOnGroupHeaderClickProperty); }
            set { SetValue(PageDestinationTypeOnGroupHeaderClickProperty, value); }
        }
        public static readonly DependencyProperty PageDestinationTypeOnGroupHeaderClickProperty =
            DependencyProperty.Register("PageDestinationTypeOnGroupHeaderClick", typeof(Type), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        void ZoomOutList_ItemClick(object sender, SuperItemClickEventArgs e)
        {
            if (ZoomInOnGroupClick && ZoomOutList.SemanticZoomOwner != null)
            {
                ZoomOutList.SemanticZoomOwner.ToggleActiveView();
                ZoomOutList.SemanticZoomOwner.ZoomedInView.MakeVisible(new SemanticZoomLocation() { Item = e.Item });
            } 
            else if (PageDestinationTypeOnGroupClick != null)
            {
                var parentPage = this.GetParentOf<Page>();
                if (parentPage != null)
                    parentPage.Frame.Navigate(PageDestinationTypeOnGroupClick, e.Item);
            }

            if (GroupClick != null)
                GroupClick(sender, e);
        }


        void ZoomInList_ItemClick(object sender, SuperItemClickEventArgs e)
        {
            if (PageDestinationTypeOnItemClick != null)
            {
                var parentPage = this.GetParentOf<Page>();
                if (parentPage != null)
                    parentPage.Frame.Navigate(PageDestinationTypeOnItemClick, e.Item);
            }

            if (ItemClick != null)
                ItemClick(sender, e);
        }

        void ZoomOutList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            _SelfUpdating = true;
            if (e.AddedItems.Count > 0)
                SelectedGroup = e.AddedItems[0];
            else
                SelectedGroup = null;
            if (GroupSelectionMode == ListViewSelectionMode.Extended || GroupSelectionMode == ListViewSelectionMode.Multiple)
            {
                foreach (var item in e.AddedItems)
                    SelectedGroups.Add(e);
                foreach (var item in e.RemovedItems)
                    SelectedGroups.Remove(e);
            }
            _SelfUpdating = false;

            if (GroupSelectionChanged != null)
                GroupSelectionChanged(sender, e);
        }

        void ZoomInList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            _SelfUpdating = true;
            if (e.AddedItems.Count > 0)
                SelectedItem = e.AddedItems[0];
            else
                SelectedItem = null;
            if (ItemSelectionMode == ListViewSelectionMode.Extended || ItemSelectionMode == ListViewSelectionMode.Multiple)
            {
                foreach (var item in e.AddedItems)
                    SelectedItems.Add(e);
                foreach (var item in e.RemovedItems)
                    SelectedItems.Remove(e);
            }
            _SelfUpdating = false;

            if (ItemSelectionChanged != null)
                ItemSelectionChanged(sender, e);
        }

        public event SelectionChangedEventHandler ItemSelectionChanged;

        public event SelectionChangedEventHandler GroupSelectionChanged;

        public event EventHandler<SuperItemClickEventArgs> ItemClick;

        public event EventHandler<SuperItemClickEventArgs> GroupClick;

        public event EventHandler<SuperItemClickEventArgs> GroupHeaderClick;

        public object ItemsSource
        {
            get { return (object)GetValue(ItemsSourceProperty); }
            set { SetValue(ItemsSourceProperty, value); }
        }
        public static readonly DependencyProperty ItemsSourceProperty =
            DependencyProperty.Register("ItemsSource", typeof(object), typeof(SuperSemanticZoomListView), new PropertyMetadata(null, ItemsSourceChanged));

        private static void ItemsSourceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ((SuperSemanticZoomListView)d).ItemsSourceChanged(e);
        }

        private void ItemsSourceChanged(DependencyPropertyChangedEventArgs e)
        {
            if (e.OldValue is ICollectionView && ((ICollectionView)ItemsSource).CollectionGroups != null)
            {
                ((ICollectionView)e.OldValue).VectorChanged += SuperSemanticZoomListView_VectorChanged;                
            }
            if (ItemsSource is ICollectionView && ((ICollectionView)ItemsSource).CollectionGroups != null)
            {
                GroupSource = ((ICollectionView)ItemsSource).CollectionGroups.Select((g) => ((ICollectionViewGroup)g).Group).ToList();
                ((ICollectionView)ItemsSource).VectorChanged += SuperSemanticZoomListView_VectorChanged;
            }
            else
            {
                GroupSource = ItemsSource;
            }
        }

        void SuperSemanticZoomListView_VectorChanged(Windows.Foundation.Collections.IObservableVector<object> sender, Windows.Foundation.Collections.IVectorChangedEventArgs @event)
        {
            GroupSource = ((ICollectionView)ItemsSource).CollectionGroups.Select((g) => ((ICollectionViewGroup)g).Group).ToList();
        }

        public Style ZoomedOutViewStyle
        {
            get { return (Style)GetValue(ZoomedOutViewStyleProperty); }
            set { SetValue(ZoomedOutViewStyleProperty, value); }
        }
        public static readonly DependencyProperty ZoomedOutViewStyleProperty =
            DependencyProperty.Register("ZoomedOutViewStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style ZoomedInViewStyle
        {
            get { return (Style)GetValue(ZoomedInViewStyleProperty); }
            set { SetValue(ZoomedInViewStyleProperty, value); }
        }
        public static readonly DependencyProperty ZoomedInViewStyleProperty =
            DependencyProperty.Register("ZoomedInViewStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public ListViewSelectionMode ItemSelectionMode
        {
            get { return (ListViewSelectionMode)GetValue(ItemSelectionModeProperty); }
            set { SetValue(ItemSelectionModeProperty, value); }
        }
        public static readonly DependencyProperty ItemSelectionModeProperty =
            DependencyProperty.Register("ItemSelectionMode", typeof(ListViewSelectionMode), typeof(SuperSemanticZoomListView), new PropertyMetadata(ListViewSelectionMode.Single));

        public ListViewSelectionMode GroupSelectionMode
        {
            get { return (ListViewSelectionMode)GetValue(GroupSelectionModeProperty); }
            set { SetValue(GroupSelectionModeProperty, value); }
        }
        public static readonly DependencyProperty GroupSelectionModeProperty =
            DependencyProperty.Register("GroupSelectionMode", typeof(ListViewSelectionMode), typeof(SuperSemanticZoomListView), new PropertyMetadata(ListViewSelectionMode.Single));

        #region ItemTemplateProperties

        public DataTemplate SnappedItemTemplate
        {
            get { return (DataTemplate)GetValue(SnappedItemTemplateProperty); }
            set { SetValue(SnappedItemTemplateProperty, value); }
        }
        public static readonly DependencyProperty SnappedItemTemplateProperty =
            DependencyProperty.Register("SnappedItemTemplate", typeof(DataTemplate), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public DataTemplate FilledItemTemplate
        {
            get { return (DataTemplate)GetValue(FilledItemTemplateProperty); }
            set { SetValue(FilledItemTemplateProperty, value); }
        }
        public static readonly DependencyProperty FilledItemTemplateProperty =
            DependencyProperty.Register("FilledItemTemplate", typeof(DataTemplate), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public DataTemplate FullScreenLandscapeItemTemplate
        {
            get { return (DataTemplate)GetValue(FullScreenLandscapeItemTemplateProperty); }
            set { SetValue(FullScreenLandscapeItemTemplateProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeItemTemplateProperty =
            DependencyProperty.Register("FullScreenLandscapeItemTemplate", typeof(DataTemplate), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public DataTemplate FullScreenPortraitItemTemplate
        {
            get { return (DataTemplate)GetValue(FullScreenPortraitItemTemplateProperty); }
            set { SetValue(FullScreenPortraitItemTemplateProperty, value); }
        }
        public static readonly DependencyProperty FullScreenPortraitItemTemplateProperty =
            DependencyProperty.Register("FullScreenPortraitItemTemplate", typeof(DataTemplate), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        #endregion ItemTemplateProperties

        #region ZoomedOutGroupTemplateProperties

        public DataTemplate SnappedZoomedOutGroupTemplate
        {
            get { return (DataTemplate)GetValue(SnappedZoomedOutGroupTemplateProperty); }
            set { SetValue(SnappedZoomedOutGroupTemplateProperty, value); }
        }
        public static readonly DependencyProperty SnappedZoomedOutGroupTemplateProperty =
            DependencyProperty.Register("SnappedZoomedOutGroupTemplate", typeof(DataTemplate), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public DataTemplate FilledZoomedOutGroupTemplate
        {
            get { return (DataTemplate)GetValue(FilledZoomedOutGroupTemplateProperty); }
            set { SetValue(FilledZoomedOutGroupTemplateProperty, value); }
        }
        public static readonly DependencyProperty FilledZoomedOutGroupTemplateProperty =
            DependencyProperty.Register("FilledZoomedOutGroupTemplate", typeof(DataTemplate), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public DataTemplate FullScreenLandscapeZoomedOutGroupTemplate
        {
            get { return (DataTemplate)GetValue(FullScreenLandscapeZoomedOutGroupTemplateProperty); }
            set { SetValue(FullScreenLandscapeZoomedOutGroupTemplateProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeZoomedOutGroupTemplateProperty =
            DependencyProperty.Register("FullScreenLandscapeZoomedOutGroupTemplate", typeof(DataTemplate), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public DataTemplate FullScreenPortraitZoomedOutGroupTemplate
        {
            get { return (DataTemplate)GetValue(FullScreenPortraitZoomedOutGroupTemplateProperty); }
            set { SetValue(FullScreenPortraitZoomedOutGroupTemplateProperty, value); }
        }
        public static readonly DependencyProperty FullScreenPortraitZoomedOutGroupTemplateProperty =
            DependencyProperty.Register("FullScreenPortraitZoomedOutGroupTemplate", typeof(DataTemplate), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        #endregion ZoomedOutGroupTemplateProperties

        #region ViewStyleProperties

        public Style SnappedViewStyle
        {
            get { return (Style)GetValue(SnappedViewStyleProperty); }
            set { SetValue(SnappedViewStyleProperty, value); }
        }
        public static readonly DependencyProperty SnappedViewStyleProperty =
            DependencyProperty.Register("SnappedViewStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style FullScreenLandscapeViewStyle
        {
            get { return (Style)GetValue(FullScreenLandscapeViewStyleProperty); }
            set { SetValue(FullScreenLandscapeViewStyleProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeViewStyleProperty =
            DependencyProperty.Register("FullScreenLandscapeViewStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style FilledViewStyle
        {
            get { return (Style)GetValue(FilledViewStyleProperty); }
            set { SetValue(FilledViewStyleProperty, value); }
        }
        public static readonly DependencyProperty FilledViewStyleProperty =
            DependencyProperty.Register("FilledViewStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style FullScreenPortraitViewStyle
        {
            get { return (Style)GetValue(FullScreenPortraitViewStyleProperty); }
            set { SetValue(FullScreenPortraitViewStyleProperty, value); }
        }
        public static readonly DependencyProperty FullScreenPortraitViewStyleProperty =
            DependencyProperty.Register("FullScreenPortraitViewStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        #endregion ViewStyleProperties

        #region ZoomedOutViewStyleProperties

        public Style SnappedZoomedOutViewStyle
        {
            get { return (Style)GetValue(SnappedZoomedOutViewStyleProperty); }
            set { SetValue(SnappedZoomedOutViewStyleProperty, value); }
        }
        public static readonly DependencyProperty SnappedZoomedOutViewStyleProperty =
            DependencyProperty.Register("SnappedZoomedOutViewStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style FullScreenLandscapeZoomedOutViewStyle
        {
            get { return (Style)GetValue(FullScreenLandscapeZoomedOutViewStyleProperty); }
            set { SetValue(FullScreenLandscapeZoomedOutViewStyleProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeZoomedOutViewStyleProperty =
            DependencyProperty.Register("FullScreenLandscapeZoomedOutViewStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style FilledZoomedOutViewStyle
        {
            get { return (Style)GetValue(FilledZoomedOutViewStyleProperty); }
            set { SetValue(FilledZoomedOutViewStyleProperty, value); }
        }
        public static readonly DependencyProperty FilledZoomedOutViewStyleProperty =
            DependencyProperty.Register("FilledZoomedOutViewStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style FullScreenPortraitZoomedOutViewStyle
        {
            get { return (Style)GetValue(FullScreenPortraitZoomedOutViewStyleProperty); }
            set { SetValue(FullScreenPortraitZoomedOutViewStyleProperty, value); }
        }
        public static readonly DependencyProperty FullScreenPortraitZoomedOutViewStyleProperty =
            DependencyProperty.Register("FullScreenPortraitZoomedOutViewStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        #endregion ZoomedOutViewStyleProperties

        #region GroupHeaderTemplateProperties

        public DataTemplate SnappedGroupHeaderTemplate
        {
            get { return (DataTemplate)GetValue(SnappedGroupHeaderTemplateProperty); }
            set { SetValue(SnappedGroupHeaderTemplateProperty, value); }
        }
        public static readonly DependencyProperty SnappedGroupHeaderTemplateProperty =
            DependencyProperty.Register("SnappedGroupHeaderTemplate", typeof(DataTemplate), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public DataTemplate FilledGroupHeaderTemplate
        {
            get { return (DataTemplate)GetValue(FilledGroupHeaderTemplateProperty); }
            set { SetValue(FilledGroupHeaderTemplateProperty, value); }
        }
        public static readonly DependencyProperty FilledGroupHeaderTemplateProperty =
            DependencyProperty.Register("FilledGroupHeaderTemplate", typeof(DataTemplate), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public DataTemplate FullScreenLandscapeGroupHeaderTemplate
        {
            get { return (DataTemplate)GetValue(FullScreenLandscapeGroupHeaderTemplateProperty); }
            set { SetValue(FullScreenLandscapeGroupHeaderTemplateProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeGroupHeaderTemplateProperty =
            DependencyProperty.Register("FullScreenLandscapeGroupHeaderTemplate", typeof(DataTemplate), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public DataTemplate FullScreenPortraitGroupHeaderTemplate
        {
            get { return (DataTemplate)GetValue(FullScreenPortraitGroupHeaderTemplateProperty); }
            set { SetValue(FullScreenPortraitGroupHeaderTemplateProperty, value); }
        }
        public static readonly DependencyProperty FullScreenPortraitGroupHeaderTemplateProperty =
            DependencyProperty.Register("FullScreenPortraitGroupHeaderTemplate", typeof(DataTemplate), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        #endregion GroupHeaderTemplateProperties

        public ItemLength FullScreenLandscapeItemWidth
        {
            get { return (ItemLength)GetValue(FullScreenLandscapeItemWidthProperty); }
            set { SetValue(FullScreenLandscapeItemWidthProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeItemWidthProperty =
            DependencyProperty.Register("FullScreenLandscapeItemWidth", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(new ItemLength("1/8")));

        public ItemLength FullScreenLandscapeItemHeight
        {
            get { return (ItemLength)GetValue(FullScreenLandscapeItemHeightProperty); }
            set { SetValue(FullScreenLandscapeItemHeightProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeItemHeightProperty =
            DependencyProperty.Register("FullScreenLandscapeItemHeight", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(new ItemLength("1/8")));

        public string FullScreenLandscapeItemWidthString
        {
            get { return FullScreenLandscapeItemWidth.ToString(); }
            set { SetValue(FullScreenLandscapeItemWidthStringProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeItemWidthStringProperty =
            DependencyProperty.Register("FullScreenLandscapeItemWidthString", typeof(string), typeof(SuperSemanticZoomListView), new PropertyMetadata(null, FullScreenLandscapeItemWidthStringPropertyChanged));

        private static void FullScreenLandscapeItemWidthStringPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ((SuperSemanticZoomListView)d).FullScreenLandscapeItemWidth = new ItemLength((string)e.NewValue);
        }

        public string FullScreenLandscapeItemHeightString
        {
            get { return FullScreenLandscapeItemHeight.ToString(); }
            set { SetValue(FullScreenLandscapeItemHeightStringProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeItemHeightStringProperty =
            DependencyProperty.Register("FullScreenLandscapeItemHeightString", typeof(string), typeof(SuperSemanticZoomListView), new PropertyMetadata(null, FullScreenLandscapeItemHeightStringPropertyChanged));

        private static void FullScreenLandscapeItemHeightStringPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ((SuperSemanticZoomListView)d).FullScreenLandscapeItemHeight = new ItemLength((string)e.NewValue);
        }

        public SuperMargin FullScreenLandscapeGroupMargin
        {
            get { return (SuperMargin)GetValue(FullScreenLandscapeGroupMarginProperty); }
            set { SetValue(FullScreenLandscapeGroupMarginProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeGroupMarginProperty =
            DependencyProperty.Register("FullScreenLandscapeGroupMargin", typeof(SuperMargin), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public string FullScreenLandscapeGroupMarginString
        {
            get { return FullScreenLandscapeGroupMargin.ToString(); }
            set { SetValue(FullScreenLandscapeGroupMarginProperty, new SuperMargin(value)); }
        }

        public ItemLength FullScreenLandscapeGroupWidth
        {
            get { return (ItemLength)GetValue(FullScreenLandscapeGroupWidthProperty); }
            set { SetValue(FullScreenLandscapeGroupWidthProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeGroupWidthProperty =
            DependencyProperty.Register("FullScreenLandscapeGroupWidth", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(new ItemLength("1/8")));
        public string FullScreenLandscapeGroupWidthString
        {
            get { return FullScreenLandscapeGroupWidth.ToString(); }
            set { SetValue(FullScreenLandscapeGroupWidthProperty, new ItemLength(value)); }
        }

        public ItemLength FullScreenLandscapeGroupHeight
        {
            get { return (ItemLength)GetValue(FullScreenLandscapeGroupHeightProperty); }
            set { SetValue(FullScreenLandscapeGroupHeightProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeGroupHeightProperty =
            DependencyProperty.Register("FullScreenLandscapeGroupHeight", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(new ItemLength("1/8")));
        public string FullScreenLandscapeGroupHeightString
        {
            get { return FullScreenLandscapeGroupHeight.ToString(); }
            set { SetValue(FullScreenLandscapeGroupHeightProperty, new ItemLength(value)); }
        }

        public ItemLength FilledGroupWidth
        {
            get { return (ItemLength)GetValue(FilledGroupWidthProperty); }
            set { SetValue(FilledGroupWidthProperty, value); }
        }
        public static readonly DependencyProperty FilledGroupWidthProperty =
            DependencyProperty.Register("FilledGroupWidth", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(new ItemLength("1/8")));
        public string FilledGroupWidthString
        {
            get { return FilledGroupWidth.ToString(); }
            set { SetValue(FilledGroupWidthProperty, new ItemLength(value)); }
        }

        public ItemLength FilledGroupHeight
        {
            get { return (ItemLength)GetValue(FilledGroupHeightProperty); }
            set { SetValue(FilledGroupHeightProperty, value); }
        }
        public static readonly DependencyProperty FilledGroupHeightProperty =
            DependencyProperty.Register("FilledGroupHeight", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(new ItemLength("1/8")));
        public string FilledGroupHeightString
        {
            get { return FilledGroupHeight.ToString(); }
            set { SetValue(FilledGroupHeightProperty, new ItemLength(value)); }
        }

        public ItemLength SnappedGroupWidth
        {
            get { return (ItemLength)GetValue(SnappedGroupWidthProperty); }
            set { SetValue(SnappedGroupWidthProperty, value); }
        }
        public static readonly DependencyProperty SnappedGroupWidthProperty =
            DependencyProperty.Register("SnappedGroupWidth", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(new ItemLength("1/8")));
        public string SnappedGroupWidthString
        {
            get { return SnappedGroupWidth.ToString(); }
            set { SetValue(SnappedGroupWidthProperty, new ItemLength(value)); }
        }

        public ItemLength SnappedGroupHeight
        {
            get { return (ItemLength)GetValue(SnappedGroupHeightProperty); }
            set { SetValue(SnappedGroupHeightProperty, value); }
        }
        public static readonly DependencyProperty SnappedGroupHeightProperty =
            DependencyProperty.Register("SnappedGroupHeight", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(new ItemLength("1/8")));
        public string SnappedGroupHeightString
        {
            get { return SnappedGroupHeight.ToString(); }
            set { SetValue(SnappedGroupHeightProperty, new ItemLength(value)); }
        }


        public ItemLength FullScreenPortraitGroupWidth
        {
            get { return (ItemLength)GetValue(FullScreenPortraitGroupWidthProperty); }
            set { SetValue(FullScreenPortraitGroupWidthProperty, value); }
        }
        public static readonly DependencyProperty FullScreenPortraitGroupWidthProperty =
            DependencyProperty.Register("FullScreenPortraitGroupWidth", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(new ItemLength("1/8")));
        public string FullScreenPortraitGroupWidthString
        {
            get { return FullScreenPortraitGroupWidth.ToString(); }
            set { SetValue(FullScreenPortraitGroupWidthProperty, new ItemLength(value)); }
        }

        public ItemLength FullScreenPortraitGroupHeight
        {
            get { return (ItemLength)GetValue(FullScreenPortraitGroupHeightProperty); }
            set { SetValue(FullScreenPortraitGroupHeightProperty, value); }
        }
        public static readonly DependencyProperty FullScreenPortraitGroupHeightProperty =
            DependencyProperty.Register("FullScreenPortraitGroupHeight", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(new ItemLength("1/8")));
        public string FullScreenPortraitGroupHeightString
        {
            get { return FullScreenPortraitGroupHeight.ToString(); }
            set { SetValue(FullScreenPortraitGroupHeightProperty, new ItemLength(value)); }
        }

        public ItemLength SnappedItemWidth
        {
            get { return (ItemLength)GetValue(SnappedItemWidthProperty); }
            set { SetValue(SnappedItemWidthProperty, value); }
        }
        public static readonly DependencyProperty SnappedItemWidthProperty =
            DependencyProperty.Register("SnappedItemWidth", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(default(ItemLength)));

        public ItemLength SnappedItemHeight
        {
            get { return (ItemLength)GetValue(SnappedItemHeightProperty); }
            set { SetValue(SnappedItemHeightProperty, value); }
        }
        public static readonly DependencyProperty SnappedItemHeightProperty =
            DependencyProperty.Register("SnappedItemHeight", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(default(ItemLength)));

        public string SnappedItemWidthString
        {
            get { return SnappedItemWidth.ToString(); }
            set { SetValue(SnappedItemWidthStringProperty, value); }
        }
        public static readonly DependencyProperty SnappedItemWidthStringProperty =
            DependencyProperty.Register("SnappedItemWidthString", typeof(string), typeof(SuperSemanticZoomListView), new PropertyMetadata(null, SnappedItemWidthStringPropertyChanged));

        private static void SnappedItemWidthStringPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ((SuperSemanticZoomListView)d).SnappedItemWidth = new ItemLength((string)e.NewValue);
        }

        public string SnappedItemHeightString
        {
            get { return SnappedItemHeight.ToString(); }
            set { SetValue(SnappedItemHeightStringProperty, value); }
        }
        public static readonly DependencyProperty SnappedItemHeightStringProperty =
            DependencyProperty.Register("SnappedItemHeightString", typeof(string), typeof(SuperSemanticZoomListView), new PropertyMetadata(null, SnappedItemHeightStringPropertyChanged));

        private static void SnappedItemHeightStringPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ((SuperSemanticZoomListView)d).SnappedItemHeight = new ItemLength((string)e.NewValue);
        }

        public SuperMargin SnappedGroupMargin
        {
            get { return (SuperMargin)GetValue(SnappedGroupMarginProperty); }
            set
            {
                SetValue(SnappedGroupMarginProperty, value);
                
            }
        }
        public static readonly DependencyProperty SnappedGroupMarginProperty =
            DependencyProperty.Register("SnappedGroupMargin", typeof(SuperMargin), typeof(SuperSemanticZoomListView), new PropertyMetadata(default(SuperMargin)));
        public string SnappedGroupMarginString
        {
            get { return SnappedGroupMargin.ToString(); }
            set { SetValue(SnappedGroupMarginProperty, new SuperMargin(value)); }
        }

        public ItemLength FullScreenPortraitItemWidth
        {
            get { return (ItemLength)GetValue(FullScreenPortraitItemWidthProperty); }
            set
            {
                SetValue(FullScreenPortraitItemWidthProperty, value);
                
            }
        }
        public static readonly DependencyProperty FullScreenPortraitItemWidthProperty =
            DependencyProperty.Register("FullScreenPortraitItemWidth", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(default(ItemLength)));
        public string FullScreenPortraitItemWidthString
        {
            get { return FullScreenPortraitItemWidth.ToString(); }
            set { SetValue(FullScreenPortraitItemWidthProperty, new ItemLength(value)); }
        }

        public ItemLength FullScreenPortraitItemHeight
        {
            get { return (ItemLength)GetValue(FullScreenPortraitItemHeightProperty); }
            set
            {
                SetValue(FullScreenPortraitItemHeightProperty, value);
                
            }
        }
        public static readonly DependencyProperty FullScreenPortraitItemHeightProperty =
            DependencyProperty.Register("FullScreenPortraitItemHeight", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(default(ItemLength)));
        public string FullScreenPortraitItemHeightString
        {
            get { return FullScreenPortraitItemHeight.ToString(); }
            set { SetValue(FullScreenPortraitItemHeightProperty, new ItemLength(value)); }
        }

        public ItemLength FullScreenPortraitGroupMargin
        {
            get { return (ItemLength)GetValue(FullScreenPortraitGroupMarginProperty); }
            set
            {
                SetValue(FullScreenPortraitGroupMarginProperty, value);
                
            }
        }
        public static readonly DependencyProperty FullScreenPortraitGroupMarginProperty =
            DependencyProperty.Register("FullScreenPortraitGroupMargin", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(default(ItemLength)));
        public string FullScreenPortraitGroupMarginString
        {
            get { return FullScreenPortraitGroupMargin.ToString(); }
            set { SetValue(FullScreenPortraitGroupMarginProperty, new ItemLength(value)); }
        }

        public ItemLength FilledItemWidth
        {
            get { return (ItemLength)GetValue(FilledItemWidthProperty); }
            set
            {
                SetValue(FilledItemWidthProperty, value);
                
            }
        }
        public static readonly DependencyProperty FilledItemWidthProperty =
            DependencyProperty.Register("FilledItemWidth", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(default(ItemLength)));
        public string FilledItemWidthString
        {
            get { return FilledItemWidth.ToString(); }
            set { SetValue(FilledItemWidthProperty, new ItemLength(value)); }
        }

        public ItemLength FilledItemHeight
        {
            get { return (ItemLength)GetValue(FilledItemHeightProperty); }
            set
            {
                SetValue(FilledItemHeightProperty, value);
                
            }
        }
        public static readonly DependencyProperty FilledItemHeightProperty =
            DependencyProperty.Register("FilledItemHeight", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(default(ItemLength)));
        public string FilledItemHeightString
        {
            get { return FilledItemHeight.ToString(); }
            set { SetValue(FilledItemHeightProperty, new ItemLength(value)); }
        }

        public ItemLength FilledGroupMargin
        {
            get { return (ItemLength)GetValue(FilledGroupMarginProperty); }
            set
            {
                SetValue(FilledGroupMarginProperty, value);
                
            }
        }
        public static readonly DependencyProperty FilledGroupMarginProperty =
            DependencyProperty.Register("FilledGroupMargin", typeof(ItemLength), typeof(SuperSemanticZoomListView), new PropertyMetadata(default(ItemLength)));
        public string FilledGroupMarginString
        {
            get { return FilledGroupMargin.ToString(); }
            set { SetValue(FilledGroupMarginProperty, new ItemLength(value)); }
        }

        private bool _SelfUpdating;

        public object GroupSource
        {
            get { return (object)GetValue(GroupSourceProperty); }
            private set { SetValue(GroupSourceProperty, value); }
        }
        public static readonly DependencyProperty GroupSourceProperty =
            DependencyProperty.Register("GroupSource", typeof(object), typeof(SuperSemanticZoomListView), new PropertyMetadata(0));

        private Func<object, Tuple<int, int>, Tuple<int, int>> _ItemColumnAndRowSpanSelector;
        public Func<object, Tuple<int, int>, Tuple<int, int>> ItemColumnAndRowSpanSelector
        {
            get 
            { 
                if (ZoomInList != null)
                    return ZoomInList.ItemColumnAndRowSpanSelector;
                return _ItemColumnAndRowSpanSelector;
            }
            set 
            {
                _ItemColumnAndRowSpanSelector = value;
                if (ZoomInList != null)
                    ZoomInList.ItemColumnAndRowSpanSelector = value; 
            }
        }

        private Func<object, Tuple<int, int>, Tuple<int, int>> _GroupColumnAndRowSpanSelector;
        public Func<object, Tuple<int, int>, Tuple<int, int>> GroupColumnAndRowSpanSelector
        {
            get 
            {
                if (ZoomOutList != null)
                    return ZoomOutList.ItemColumnAndRowSpanSelector;
                return _GroupColumnAndRowSpanSelector;
            }
            set 
            {
                _GroupColumnAndRowSpanSelector = value;
                if (ZoomOutList != null)
                    ZoomOutList.ItemColumnAndRowSpanSelector = value;
            }
        }

        public Style FullScreenLandscapeItemContainerStyle
        {
            get { return (Style)GetValue(FullScreenLandscapeItemContainerStyleProperty); }
            set { SetValue(FullScreenLandscapeItemContainerStyleProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeItemContainerStyleProperty =
            DependencyProperty.Register("FullScreenLandscapeItemContainerStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style FilledItemContainerStyle
        {
            get { return (Style)GetValue(FilledItemContainerStyleProperty); }
            set { SetValue(FilledItemContainerStyleProperty, value); }
        }
        public static readonly DependencyProperty FilledItemContainerStyleProperty =
            DependencyProperty.Register("FilledItemContainerStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style FullScreenPortraitItemContainerStyle
        {
            get { return (Style)GetValue(FullScreenPortraitPropertyItemContainerStyle); }
            set { SetValue(FullScreenPortraitPropertyItemContainerStyle, value); }
        }
        public static readonly DependencyProperty FullScreenPortraitPropertyItemContainerStyle =
            DependencyProperty.Register("FullScreenPortraitItemContainerStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style SnappedItemContainerStyle
        {
            get { return (Style)GetValue(SnappedItemContainerStyleProperty); }
            set { SetValue(SnappedItemContainerStyleProperty, value); }
        }
        public static readonly DependencyProperty SnappedItemContainerStyleProperty =
            DependencyProperty.Register("SnappedItemContainerStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style FullScreenLandscapeZoomOutItemContainerStyle
        {
            get { return (Style)GetValue(FullScreenLandscapeZoomOutItemContainerStyleProperty); }
            set { SetValue(FullScreenLandscapeZoomOutItemContainerStyleProperty, value); }
        }
        public static readonly DependencyProperty FullScreenLandscapeZoomOutItemContainerStyleProperty =
            DependencyProperty.Register("FullScreenLandscapeZoomOutItemContainerStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style FilledZoomOutItemContainerStyle
        {
            get { return (Style)GetValue(FilledZoomOutItemContainerStyleProperty); }
            set { SetValue(FilledZoomOutItemContainerStyleProperty, value); }
        }
        public static readonly DependencyProperty FilledZoomOutItemContainerStyleProperty =
            DependencyProperty.Register("FilledZoomOutItemContainerStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style FullScreenPortraitZoomOutItemContainerStyle
        {
            get { return (Style)GetValue(FullScreenPortraitPropertyZoomOutItemContainerStyle); }
            set { SetValue(FullScreenPortraitPropertyZoomOutItemContainerStyle, value); }
        }
        public static readonly DependencyProperty FullScreenPortraitPropertyZoomOutItemContainerStyle =
            DependencyProperty.Register("FullScreenPortraitZoomOutItemContainerStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));

        public Style SnappedZoomOutItemContainerStyle
        {
            get { return (Style)GetValue(SnappedZoomOutItemContainerStyleProperty); }
            set { SetValue(SnappedZoomOutItemContainerStyleProperty, value); }
        }
        public static readonly DependencyProperty SnappedZoomOutItemContainerStyleProperty =
            DependencyProperty.Register("SnappedZoomOutItemContainerStyle", typeof(Style), typeof(SuperSemanticZoomListView), new PropertyMetadata(null));
    }
}
